<ui:component xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

	<style>
.ui-accordion .ui-accordion-content {
	padding: 0px 15px 2px 15px;
}

img#subMenuIcon {
	padding-right: 5px;
	vertical-align: middle;
	border: 0px;
}
</style>

	<h:form>
		<p:accordionPanel value="#{menuController.menus}" var="menu">
			<p:tab title="#{menu.group}">
				<ul>
					<ui:repeat value="#{menu.subMenu}" var="subMenu">
						<p:commandLink ajax="true" oncomplete="updateTabView()">
							<f:setPropertyActionListener target="#{tabViewController.label}"
								value="#{subMenu.label}" />
							<f:setPropertyActionListener target="#{tabViewController.url}"
								value="#{subMenu.url}" />
							<f:setPropertyActionListener target="#{tabViewController.tabID}"
								value="#{subMenu.tabID}" />

							<img id="subMenuIcon"
								src="#{request.contextPath}/img/icons/#{subMenu.iconImg}" />
							<h:outputText value="#{subMenu.label}" />

						</p:commandLink>
						<br />
					</ui:repeat>
				</ul>
				
				<p:remoteCommand name="updateTabView" update=":tabView"></p:remoteCommand>
			</p:tab>
		</p:accordionPanel>
		
	</h:form>
</ui:component>